#include "core.h"
#include "intensityManager.h"
#include <iostream>

#include <pthread.h>

using namespace std;


Core::Core()
{
	id=1;
	im=new IntensityManager();
	if (im->deckLinkIterator==NULL)
		ok=false;
	else
		ok=true;
		
	im->connectIntensity();
	im->getInputManager();
	im->getDisplayModes();
	im->setDisplayMode(P720_5994);
	
	ccb=new CaptureCallback();
	
	im->input->SetCallback(ccb);
	
	pthread_mutex_t	sleepMutex;
	pthread_cond_t sleepCond;
	
	pthread_mutex_init(&sleepMutex, NULL);
	pthread_cond_init(&sleepCond, NULL);
	
	pthread_mutex_lock(&sleepMutex);
	pthread_cond_wait(&sleepCond, &sleepMutex);
	if (ccb->once)
		pthread_mutex_unlock(&sleepMutex);
	cout << "[Core] Stopping..." << endl;
};


